package com.pearadmin.pro.modules.experiment.controller;

import com.pearadmin.pro.common.aop.annotation.Log;
import com.pearadmin.pro.common.constant.ControllerConstant;
import com.pearadmin.pro.common.web.base.BaseController;
import com.pearadmin.pro.common.web.domain.Result;
import com.pearadmin.pro.modules.experiment.entity.ExperimentInfo;
import com.pearadmin.pro.modules.experiment.entity.ExperimentMajor;
import com.pearadmin.pro.modules.experiment.service.ExperimentMajorService;
import com.pearadmin.pro.modules.experiment.service.ExperimentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 实验空间专业分类
 *
 * @author ZhouXingYun
 * @date 2022/6/14 16:50
 */
@Api(tags = {"实验空间专业分类"})
@RestController
@RequestMapping(ControllerConstant.PREFIX_SYS + "emj")
public class ExperimentMajorController extends BaseController {

    @Resource
    private ExperimentMajorService experimentMajorService;

    /**
     * 筛选列表
     *
     * @return {@link Result}
     */
    @GetMapping("filtrate")
    @Log(title = "筛选列表")
    @ApiOperation(value = "筛选列表")
    public Result filtrate() {
        List<ExperimentMajor> majorList = experimentMajorService.filtrate();
        return success(majorList);
    }

    /**
     * 二级筛选列表
     *
     * @return {@link Result}
     */
    @GetMapping("getClssify")
    @Log(title = "二级筛选列表")
    @ApiOperation(value = "二级筛选列表")
    public Result getClssify(@RequestParam("id")Integer id) {
        System.out.println("二级筛选列表"+id);
        List<ExperimentMajor> majorList = experimentMajorService.getClssify(id);
        return success(majorList);
    }
    /**
     * 查询专业（树）
     * @author ZhouXingYun
     * @date 2022/6/21 11:37
     * @return com.pearadmin.pro.common.web.domain.Result
     */
    @GetMapping("tree")
    @Log(title = "查询专业")
    @ApiOperation(value = "查询专业")
    public Result tree(){
        return success(experimentMajorService.tree());
    }

}
